class Cpanel::BaseController < ApplicationController

  layout "cpanel"

  before_action :login?

  def index

  end

  private

  def current_user
    user ||= User.find(session[:user_id]) if session[:user_id]
  end

  helper_method :current_user

  def login?
    if current_user.nil?
      redirect_to login_path, notice: "you need login"
    end
  end

end
